package com.example.demo.service;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.example.demo.entity.User;
import com.example.demo.mapper.ReplaceMapper;
import com.example.demo.mapper.UserMapper;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserService {
    @Resource
    private UserMapper userMapper;

    public User queryByName(String username) {
        List<User> list = userMapper.selectList(Wrappers.<User>lambdaQuery()
                .eq(User::getUsername,username));
        if(!list.isEmpty()) {
            return list.get(0);
        }
        return null;
    }

}
